home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / vdtj122b.zip / DEMO4A.TXT < prev    next >
Text File  |  1992-10-25  |  1KB  |  49 lines

  1. /* EXPAND - Expand and display control sequence */
  2.  
  3. expand(kbuf)
  4. unsigned char *kbuf;
  5. {
  6. unsigned char *sptr, *kptr, c;
  7. unsigned char messbuf[MAXSTR], save[MAXSTR];
  8.  
  9. int getmess();
  10.  
  11.     kptr = kbuf;
  12.     sptr = save;        /* Init PTR to buffer ending in 00 */
  13.  
  14.     /* Convert "^Z" to CTRL-Z and change to use 00 terminator */
  15.  
  16.     while (*kptr != KFF) {
  17.     *sptr = *kptr++;
  18.     if (*sptr == '^') {
  19.         if (*kptr != '^') *sptr = *kptr & 0x1F;
  20.             kptr++;
  21.         }
  22.     sptr++;
  23.     }
  24.     *sptr = 0;            /* SAVE[] ends in 00 terminator */
  25.  
  26.     sptr = save;
  27.     if (*sptr == 0) {        /* Change IBM System call to ROM call */
  28.     sptr++;
  29.     *sptr |= 0x80;        /* Set high bit on next char */
  30.     }
  31.  
  32.     if ( getmess(messbuf,sptr,topname) )
  33.     output("<%s>",messbuf);         /* display string and key codes */
  34.  
  35.     else {
  36.  
  37.     for (sptr=save; *sptr; sptr++) {
  38.         c = *sptr;
  39.         if (c & 0x80) {
  40.             output("%s", func);
  41.             c &= 0x7f;
  42.             }
  43.         mnemonic(c);    /* Convert char to mnemonic if possible */
  44.         outc(SPACE);
  45.         }
  46.     }
  47. }
  48.  
  49.